﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Text;

public partial class sandbox_test_writeTrans : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        write();
    }

    private void write()
    {
        DatabaseUtil dbUtil = new DatabaseUtil();
        //Get language table for cache to avoid database loading
        Hashtable table = dbUtil.getLangTable();
        //Write fake data to db and return the lang_no
        //int lang = dbUtil.writeTranslatedTxt(999, 999, "Taipei 101", "en");
        //Response.Write("Test Successfully, the lang_no is: "+lang);
        //Response.Write("<BR>");
        //Response.Write(dbUtil.getPropertyPost("",dbUtil.getTranlatePosts(999, new int[]{999}), 999, "en"));
        //lang = dbUtil.writeTranslatedTxt(999, 1000, "台北 101", "zh-cn");
        //Response.Write("Test Successfully, the lang_no is: " + lang);
        //Response.Write("<BR>");
        //Response.Write(dbUtil.getPropertyPost("", dbUtil.getTranlatePosts(999, new int[] { 1000 }), 1000, "en"));
        String testStr = "高雄跨年                                                                                                ";
        //testStr = testStr.Substring(0, 500);
        //int length = testStr.Length;
        int lang = dbUtil.writeTranslatedTxt(499, 499, testStr.Trim(), LanguageConst.CHINESE_TRADITIONAL);
        Response.Write("Test Successfully, the lang_no is: " + lang);
        Response.Write("<BR>");
        Response.Write(dbUtil.getPropertyPost("", dbUtil.getTranlatePosts(499, new int[] { 499 }), 499, LanguageConst.CHINESE_TRADITIONAL));
    }

    private String produceTestString(int length)
    {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < length; i++)
            sb.Append("i");
        return sb.ToString();
    }
}
